package main;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
 

public enum MusicType {
 MP3 , WAVE ;


	static HashMap <String, MusicType> stringRepMap = new HashMap<String, MusicType>();
	static HashMap <MusicType, String> stringRep  = new HashMap<MusicType, String>();
	static 
	{
		stringRepMap.put("mp3" ,MP3);
		stringRepMap.put( "wav", WAVE );
		stringRep.put( MP3, "mp3");
		stringRep.put( WAVE, "wav" );
	}
 
	public static MusicType getType(String type) {
		for(Entry<String, MusicType> t : stringRepMap.entrySet()) {
			if (type.equalsIgnoreCase(t.getKey())) {
				return t.getValue();
			}
		}
		return null;
	}
	
	public static String getString(MusicType type) {
		return stringRep.get(type);
	}
	
	
}
